/*
 * Copyright (c) 2023, Texas Instruments Incorporated - http://www.ti.com
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 *  ============ ti_msp_dl_config.h =============
 *  Configured MSPM0 DriverLib module declarations
 *
 *  DO NOT EDIT - This file is generated for the MSPM0G350X
 *  by the SysConfig tool.
 */
#ifndef ti_msp_dl_config_h
#define ti_msp_dl_config_h

#define CONFIG_MSPM0G350X

#if defined(__ti_version__) | defined(__TI_COMPILER_VERSION__)
#define SYSCONFIG_WEAK __attribute__((weak))
#elif defined(__IAR_SYSTEMS_ICC__)
#define SYSCONFIG_WEAK __weak
#elif defined(__GNUC__)
#define SYSCONFIG_WEAK __attribute__((weak))
#elif defined(__CC_ARM) || defined(__ARMCC_VERSION)
#define SYSCONFIG_WEAK __attribute__((weak))
#endif

#include <ti/devices/msp/msp.h>
#include <ti/driverlib/driverlib.h>
#include <ti/driverlib/m0p/dl_core.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
 *  ======== SYSCFG_DL_init ========
 *  Perform all required MSP DL initialization
 *
 *  This function should be called once at a point before any use of
 *  MSP DL.
 */


/* clang-format off */

#define POWER_STARTUP_DELAY                                                (16)



#define CPUCLK_FREQ                                                     32000000



/* Defines for PWM_1 */
#define PWM_1_INST                                                         TIMG0
#define PWM_1_INST_IRQHandler                                   TIMG0_IRQHandler
#define PWM_1_INST_INT_IRQN                                     (TIMG0_INT_IRQn)
#define PWM_1_INST_CLK_FREQ                                              4000000
/* GPIO defines for channel 0 */
#define GPIO_PWM_1_C0_PORT                                                 GPIOA
#define GPIO_PWM_1_C0_PIN                                         DL_GPIO_PIN_12
#define GPIO_PWM_1_C0_IOMUX                                      (IOMUX_PINCM34)
#define GPIO_PWM_1_C0_IOMUX_FUNC                     IOMUX_PINCM34_PF_TIMG0_CCP0
#define GPIO_PWM_1_C0_IDX                                    DL_TIMER_CC_0_INDEX

/* Defines for PWM_2 */
#define PWM_2_INST                                                         TIMA0
#define PWM_2_INST_IRQHandler                                   TIMA0_IRQHandler
#define PWM_2_INST_INT_IRQN                                     (TIMA0_INT_IRQn)
#define PWM_2_INST_CLK_FREQ                                              4000000
/* GPIO defines for channel 0 */
#define GPIO_PWM_2_C0_PORT                                                 GPIOB
#define GPIO_PWM_2_C0_PIN                                          DL_GPIO_PIN_8
#define GPIO_PWM_2_C0_IOMUX                                      (IOMUX_PINCM25)
#define GPIO_PWM_2_C0_IOMUX_FUNC                     IOMUX_PINCM25_PF_TIMA0_CCP0
#define GPIO_PWM_2_C0_IDX                                    DL_TIMER_CC_0_INDEX
/* GPIO defines for channel 1 */
#define GPIO_PWM_2_C1_PORT                                                 GPIOB
#define GPIO_PWM_2_C1_PIN                                          DL_GPIO_PIN_9
#define GPIO_PWM_2_C1_IOMUX                                      (IOMUX_PINCM26)
#define GPIO_PWM_2_C1_IOMUX_FUNC                     IOMUX_PINCM26_PF_TIMA0_CCP1
#define GPIO_PWM_2_C1_IDX                                    DL_TIMER_CC_1_INDEX

/* Defines for PWM_3 */
#define PWM_3_INST                                                         TIMG7
#define PWM_3_INST_IRQHandler                                   TIMG7_IRQHandler
#define PWM_3_INST_INT_IRQN                                     (TIMG7_INT_IRQn)
#define PWM_3_INST_CLK_FREQ                                              4000000
/* GPIO defines for channel 0 */
#define GPIO_PWM_3_C0_PORT                                                 GPIOA
#define GPIO_PWM_3_C0_PIN                                         DL_GPIO_PIN_17
#define GPIO_PWM_3_C0_IOMUX                                      (IOMUX_PINCM39)
#define GPIO_PWM_3_C0_IOMUX_FUNC                     IOMUX_PINCM39_PF_TIMG7_CCP0
#define GPIO_PWM_3_C0_IDX                                    DL_TIMER_CC_0_INDEX



/* Defines for CAPTURE_0 */
#define CAPTURE_0_INST                                                  (TIMG12)
#define CAPTURE_0_INST_IRQHandler                              TIMG12_IRQHandler
#define CAPTURE_0_INST_INT_IRQN                                (TIMG12_INT_IRQn)
#define CAPTURE_0_INST_LOAD_VALUE                                        (3999U)
/* GPIO defines for channel 0 */
#define GPIO_CAPTURE_0_C0_PORT                                             GPIOA
#define GPIO_CAPTURE_0_C0_PIN                                     DL_GPIO_PIN_10
#define GPIO_CAPTURE_0_C0_IOMUX                                  (IOMUX_PINCM21)
#define GPIO_CAPTURE_0_C0_IOMUX_FUNC                IOMUX_PINCM21_PF_TIMG12_CCP0





/* Defines for TIMER_0 */
#define TIMER_0_INST                                                     (TIMA1)
#define TIMER_0_INST_IRQHandler                                 TIMA1_IRQHandler
#define TIMER_0_INST_INT_IRQN                                   (TIMA1_INT_IRQn)
#define TIMER_0_INST_LOAD_VALUE                                            (39U)



/* Defines for UART_2 */
#define UART_2_INST                                                        UART2
#define UART_2_INST_IRQHandler                                  UART2_IRQHandler
#define UART_2_INST_INT_IRQN                                      UART2_INT_IRQn
#define GPIO_UART_2_RX_PORT                                                GPIOB
#define GPIO_UART_2_TX_PORT                                                GPIOB
#define GPIO_UART_2_RX_PIN                                        DL_GPIO_PIN_16
#define GPIO_UART_2_TX_PIN                                        DL_GPIO_PIN_15
#define GPIO_UART_2_IOMUX_RX                                     (IOMUX_PINCM33)
#define GPIO_UART_2_IOMUX_TX                                     (IOMUX_PINCM32)
#define GPIO_UART_2_IOMUX_RX_FUNC                      IOMUX_PINCM33_PF_UART2_RX
#define GPIO_UART_2_IOMUX_TX_FUNC                      IOMUX_PINCM32_PF_UART2_TX
#define UART_2_BAUD_RATE                                                  (9600)
#define UART_2_IBRD_4_MHZ_9600_BAUD                                         (26)
#define UART_2_FBRD_4_MHZ_9600_BAUD                                          (3)
/* Defines for UART_1 */
#define UART_1_INST                                                        UART1
#define UART_1_INST_IRQHandler                                  UART1_IRQHandler
#define UART_1_INST_INT_IRQN                                      UART1_INT_IRQn
#define GPIO_UART_1_RX_PORT                                                GPIOB
#define GPIO_UART_1_TX_PORT                                                GPIOB
#define GPIO_UART_1_RX_PIN                                         DL_GPIO_PIN_7
#define GPIO_UART_1_TX_PIN                                         DL_GPIO_PIN_6
#define GPIO_UART_1_IOMUX_RX                                     (IOMUX_PINCM24)
#define GPIO_UART_1_IOMUX_TX                                     (IOMUX_PINCM23)
#define GPIO_UART_1_IOMUX_RX_FUNC                      IOMUX_PINCM24_PF_UART1_RX
#define GPIO_UART_1_IOMUX_TX_FUNC                      IOMUX_PINCM23_PF_UART1_TX
#define UART_1_BAUD_RATE                                                (115200)
#define UART_1_IBRD_32_MHZ_115200_BAUD                                      (17)
#define UART_1_FBRD_32_MHZ_115200_BAUD                                      (23)
/* Defines for UART_3 */
#define UART_3_INST                                                        UART3
#define UART_3_INST_IRQHandler                                  UART3_IRQHandler
#define UART_3_INST_INT_IRQN                                      UART3_INT_IRQn
#define GPIO_UART_3_RX_PORT                                                GPIOB
#define GPIO_UART_3_TX_PORT                                                GPIOB
#define GPIO_UART_3_RX_PIN                                         DL_GPIO_PIN_3
#define GPIO_UART_3_TX_PIN                                         DL_GPIO_PIN_2
#define GPIO_UART_3_IOMUX_RX                                     (IOMUX_PINCM16)
#define GPIO_UART_3_IOMUX_TX                                     (IOMUX_PINCM15)
#define GPIO_UART_3_IOMUX_RX_FUNC                      IOMUX_PINCM16_PF_UART3_RX
#define GPIO_UART_3_IOMUX_TX_FUNC                      IOMUX_PINCM15_PF_UART3_TX
#define UART_3_BAUD_RATE                                                  (9600)
#define UART_3_IBRD_32_MHZ_9600_BAUD                                       (208)
#define UART_3_FBRD_32_MHZ_9600_BAUD                                        (21)





/* Port definition for Pin Group KEY1 */
#define KEY1_PORT                                                        (GPIOB)

/* Defines for PIN_19: GPIOB.19 with pinCMx 45 on package pin 16 */
// groups represented: ["KEY2","KEY4","KEY1"]
// pins affected: ["PIN_18","PIN_17","PIN_19"]
#define GPIO_MULTIPLE_GPIOB_INT_IRQN                            (GPIOB_INT_IRQn)
#define GPIO_MULTIPLE_GPIOB_INT_IIDX            (DL_INTERRUPT_GROUP1_IIDX_GPIOB)
#define KEY1_PIN_19_IIDX                                    (DL_GPIO_IIDX_DIO19)
#define KEY1_PIN_19_PIN                                         (DL_GPIO_PIN_19)
#define KEY1_PIN_19_IOMUX                                        (IOMUX_PINCM45)
/* Port definition for Pin Group KEY2 */
#define KEY2_PORT                                                        (GPIOB)

/* Defines for PIN_18: GPIOB.18 with pinCMx 44 on package pin 15 */
#define KEY2_PIN_18_IIDX                                    (DL_GPIO_IIDX_DIO18)
#define KEY2_PIN_18_PIN                                         (DL_GPIO_PIN_18)
#define KEY2_PIN_18_IOMUX                                        (IOMUX_PINCM44)
/* Port definition for Pin Group OLED_SCL */
#define OLED_SCL_PORT                                                    (GPIOA)

/* Defines for PIN_15: GPIOA.15 with pinCMx 37 on package pin 8 */
#define OLED_SCL_PIN_15_PIN                                     (DL_GPIO_PIN_15)
#define OLED_SCL_PIN_15_IOMUX                                    (IOMUX_PINCM37)
/* Port definition for Pin Group OLED_SDA */
#define OLED_SDA_PORT                                                    (GPIOA)

/* Defines for PIN_16: GPIOA.16 with pinCMx 38 on package pin 9 */
#define OLED_SDA_PIN_16_PIN                                     (DL_GPIO_PIN_16)
#define OLED_SDA_PIN_16_IOMUX                                    (IOMUX_PINCM38)
/* Port definition for Pin Group ENCODER10 */
#define ENCODER10_PORT                                                   (GPIOA)

/* Defines for PIN_8: GPIOA.8 with pinCMx 19 on package pin 54 */
// groups represented: ["ENCODER20","KEY3","ENCODER10"]
// pins affected: ["PIN_13","PIN_22","PIN_8"]
#define GPIO_MULTIPLE_GPIOA_INT_IRQN                            (GPIOA_INT_IRQn)
#define GPIO_MULTIPLE_GPIOA_INT_IIDX            (DL_INTERRUPT_GROUP1_IIDX_GPIOA)
#define ENCODER10_PIN_8_IIDX                                 (DL_GPIO_IIDX_DIO8)
#define ENCODER10_PIN_8_PIN                                      (DL_GPIO_PIN_8)
#define ENCODER10_PIN_8_IOMUX                                    (IOMUX_PINCM19)
/* Port definition for Pin Group ENCODER11 */
#define ENCODER11_PORT                                                   (GPIOA)

/* Defines for PIN_9: GPIOA.9 with pinCMx 20 on package pin 55 */
#define ENCODER11_PIN_9_PIN                                      (DL_GPIO_PIN_9)
#define ENCODER11_PIN_9_IOMUX                                    (IOMUX_PINCM20)
/* Port definition for Pin Group ENCODER20 */
#define ENCODER20_PORT                                                   (GPIOA)

/* Defines for PIN_13: GPIOA.13 with pinCMx 35 on package pin 6 */
#define ENCODER20_PIN_13_IIDX                               (DL_GPIO_IIDX_DIO13)
#define ENCODER20_PIN_13_PIN                                    (DL_GPIO_PIN_13)
#define ENCODER20_PIN_13_IOMUX                                   (IOMUX_PINCM35)
/* Port definition for Pin Group ENCODER21 */
#define ENCODER21_PORT                                                   (GPIOA)

/* Defines for PIN_14: GPIOA.14 with pinCMx 36 on package pin 7 */
#define ENCODER21_PIN_14_PIN                                    (DL_GPIO_PIN_14)
#define ENCODER21_PIN_14_IOMUX                                   (IOMUX_PINCM36)
/* Port definition for Pin Group KEY3 */
#define KEY3_PORT                                                        (GPIOA)

/* Defines for PIN_22: GPIOA.22 with pinCMx 47 on package pin 18 */
#define KEY3_PIN_22_IIDX                                    (DL_GPIO_IIDX_DIO22)
#define KEY3_PIN_22_PIN                                         (DL_GPIO_PIN_22)
#define KEY3_PIN_22_IOMUX                                        (IOMUX_PINCM47)
/* Port definition for Pin Group KEY4 */
#define KEY4_PORT                                                        (GPIOB)

/* Defines for PIN_17: GPIOB.17 with pinCMx 43 on package pin 14 */
#define KEY4_PIN_17_IIDX                                    (DL_GPIO_IIDX_DIO17)
#define KEY4_PIN_17_PIN                                         (DL_GPIO_PIN_17)
#define KEY4_PIN_17_IOMUX                                        (IOMUX_PINCM43)
/* Port definition for Pin Group GRAY1 */
#define GRAY1_PORT                                                       (GPIOA)

/* Defines for PIN_0: GPIOA.7 with pinCMx 14 on package pin 49 */
#define GRAY1_PIN_0_PIN                                          (DL_GPIO_PIN_7)
#define GRAY1_PIN_0_IOMUX                                        (IOMUX_PINCM14)
/* Port definition for Pin Group GRAY2 */
#define GRAY2_PORT                                                       (GPIOB)

/* Defines for PIN_1: GPIOB.20 with pinCMx 48 on package pin 19 */
#define GRAY2_PIN_1_PIN                                         (DL_GPIO_PIN_20)
#define GRAY2_PIN_1_IOMUX                                        (IOMUX_PINCM48)
/* Port definition for Pin Group GRAY3 */
#define GRAY3_PORT                                                       (GPIOB)

/* Defines for PIN_2: GPIOB.24 with pinCMx 52 on package pin 23 */
#define GRAY3_PIN_2_PIN                                         (DL_GPIO_PIN_24)
#define GRAY3_PIN_2_IOMUX                                        (IOMUX_PINCM52)
/* Port definition for Pin Group GRAY4 */
#define GRAY4_PORT                                                       (GPIOA)

/* Defines for PIN_3: GPIOA.24 with pinCMx 54 on package pin 25 */
#define GRAY4_PIN_3_PIN                                         (DL_GPIO_PIN_24)
#define GRAY4_PIN_3_IOMUX                                        (IOMUX_PINCM54)
/* Port definition for Pin Group GRAY5 */
#define GRAY5_PORT                                                       (GPIOA)

/* Defines for PIN_4: GPIOA.25 with pinCMx 55 on package pin 26 */
#define GRAY5_PIN_4_PIN                                         (DL_GPIO_PIN_25)
#define GRAY5_PIN_4_IOMUX                                        (IOMUX_PINCM55)
/* Port definition for Pin Group GRAY6 */
#define GRAY6_PORT                                                       (GPIOA)

/* Defines for PIN_5: GPIOA.26 with pinCMx 59 on package pin 30 */
#define GRAY6_PIN_5_PIN                                         (DL_GPIO_PIN_26)
#define GRAY6_PIN_5_IOMUX                                        (IOMUX_PINCM59)
/* Port definition for Pin Group GRAY7 */
#define GRAY7_PORT                                                       (GPIOA)

/* Defines for PIN_6: GPIOA.27 with pinCMx 60 on package pin 31 */
#define GRAY7_PIN_6_PIN                                         (DL_GPIO_PIN_27)
#define GRAY7_PIN_6_IOMUX                                        (IOMUX_PINCM60)
/* Port definition for Pin Group GRAY8 */
#define GRAY8_PORT                                                       (GPIOA)

/* Defines for PIN_7: GPIOA.4 with pinCMx 9 on package pin 44 */
#define GRAY8_PIN_7_PIN                                          (DL_GPIO_PIN_4)
#define GRAY8_PIN_7_IOMUX                                         (IOMUX_PINCM9)
/* Port definition for Pin Group GRAY9 */
#define GRAY9_PORT                                                       (GPIOA)

/* Defines for PIN_10: GPIOA.28 with pinCMx 3 on package pin 35 */
#define GRAY9_PIN_10_PIN                                        (DL_GPIO_PIN_28)
#define GRAY9_PIN_10_IOMUX                                        (IOMUX_PINCM3)
/* Port definition for Pin Group GRAY10 */
#define GRAY10_PORT                                                      (GPIOA)

/* Defines for PIN_11: GPIOA.31 with pinCMx 6 on package pin 39 */
#define GRAY10_PIN_11_PIN                                       (DL_GPIO_PIN_31)
#define GRAY10_PIN_11_IOMUX                                       (IOMUX_PINCM6)



/* clang-format on */

void SYSCFG_DL_init(void);
void SYSCFG_DL_initPower(void);
void SYSCFG_DL_GPIO_init(void);
void SYSCFG_DL_SYSCTL_init(void);
void SYSCFG_DL_PWM_1_init(void);
void SYSCFG_DL_PWM_2_init(void);
void SYSCFG_DL_PWM_3_init(void);
void SYSCFG_DL_CAPTURE_0_init(void);
void SYSCFG_DL_TIMER_0_init(void);
void SYSCFG_DL_UART_2_init(void);
void SYSCFG_DL_UART_1_init(void);
void SYSCFG_DL_UART_3_init(void);

void SYSCFG_DL_SYSTICK_init(void);

bool SYSCFG_DL_saveConfiguration(void);
bool SYSCFG_DL_restoreConfiguration(void);

#ifdef __cplusplus
}
#endif

#endif /* ti_msp_dl_config_h */
